﻿<%@ Page Language="C#" MasterPageFile="~/WebSite.Master" AutoEventWireup="true" 
CodeBehind="BidUserRole.aspx.cs" Inherits="RN.ERP.Web.Manage.RoleAdd" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Styles/skins/blue/css/style_msg.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../Scripts/jquery.min.js"></script>
    <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <script type="text/javascript" src="../Scripts/ligerUI/js/plugins/ligerGrid.js"></script>
    <script type="text/javascript" src="../Scripts/ligerUI/js/plugins/ligerLayout.js"></script>
    <script type="text/javascript" src="../Scripts/ligerUI/js/plugins/ligerTextBox.js"></script>
    <script src="../Scripts/ligerUI/js/ligerui.all.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
        $(function () {
            var dataGridRoleType = [
                { id: 1, name: '企业', group: '1' },
                { id: 2, name: '主管', group: '2' }
                ];
            $("#rdlRoleType").ligerRadioList({
                data: dataGridRoleType,
                textField: 'name'
            });

            //页面传参
            String.prototype.getQuery = function (name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = this.substr(this.indexOf("\?") + 1).match(reg);
                if (r != null) return unescape(r[2]);
                return null;
            }
            var userGuid = window.location.toString().getQuery('UserGuid');
            var userName = window.location.toString().getQuery('UserName');

            $("#lbName").html(userName);

            //保存按钮
            function btnSaveClick() {
                var txtRoleNum = $("#txtRoleNum").val();
                var txtRoleArea = $("#txtRoleArea").val();
                
                if (!txtRoleNum) { alert("角色编号不能为空！"); return false; }
                if (!txtRoleArea) { alert("角色地区不能为空！"); return false; }
                if (!userGuid) { alert("角色信息异常！"); return false; }
                
                SaveRoleType(userGuid, txtRoleNum, txtRoleArea);
            }
            $("#btnSave").ligerButton(
            {
                text: '保存',
                click: btnSaveClick
            });
            function SaveRoleType(userGuid, txtRoleNum, txtRoleArea) {
                $.ajax({
                    type: 'post',
                    cache: false,
                    data: { UserGuid: userGuid, RoleNum: txtRoleNum, RoleArea: txtRoleArea },
                    url: '../handlers/AuthorityHandler.ashx?act=dosaverolebyre&r=' + Math.random(),
                    success: function (result) {
                        alert(result);
                        window.location.href = "UserInfo.aspx";
                    }
                });
            }

        });
        
    </script>
    <style type="text/css">
           body{ font-size:12px;}
        .l-table-edit {margin: 0 auto;}
        .l-table-edit-td{ padding:4px;}
        .l-button-submit,.l-button-reset{width:80px; float:left;padding-bottom:2px;}
        .l-verify-tip{ left:230px; top:120px;}
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<div id="layout" style="margin: 0 auto; margin-right: 3px;">
    <div position="center" style="margin: 50px auto;" id="mainmenu">

        <table cellpadding="0" cellspacing="0" class="l-table-edit" >
            <tr>
                <td align="right" class="l-table-edit-td">姓名:</td>
                <td align="left" class="l-table-edit-td"><label id="lbName"></label></td>
                <td align="left"></td>
            </tr>

            <tr>
                <td align="right" class="l-table-edit-td">角色编号:</td>
                <td align="left" class="l-table-edit-td"><input name="txtRoleNum" type="text" id="txtRoleNum" /></td>
                <td align="left"></td>
            </tr>

            <tr>
                <td align="right" class="l-table-edit-td">角色地区:</td>
                <td align="left" class="l-table-edit-td"><input name="txtRoleArea" type="text" id="txtRoleArea" /></td>
                <td align="left"></td>
            </tr>

            <tr>
                <td align="right" class="l-table-edit-td"></td>
                <td align="left" class="l-table-edit-td">
                     <div style="margin: 5px auto;" id="btnSave" class="l-button l-button-submit" ></div>
                </td>
                <td align="left"></td>
            </tr>
        </table>
        
    </div>
</div>

</asp:Content>
